Skip to content

Conversation

@sheetalkharab
Copy link

@sheetalkharab sheetalkharab commented Oct 12, 2025

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I pushed all my prep exercise change

Questions

no

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@sheetalkharab sheetalkharab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

6 similar comments
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@DaryaShirokova DaryaShirokova added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 12, 2025
bankAccount.py Outdated
@@ -0,0 +1,32 @@
def open_account(balances, name, amount):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the exercise is not to just find a bug, but use mypy to do that. Could you please add types to this file and others as well? You will need to add mypy to requirements.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I have already added type annotations to all functions in this file and other related files and used mypy to check for type consistency. The mypy check shows Success: no issues found.
I realized I had forgotten to include mypy in requirements.txt, but I’ve now added it so it will be installed automatically.

today_date = date.today()
birth_date= self.date_of_birth
#to check date and month as well
age = today_date.year-birth_date.year- ((today_date.month, today_date.day) < (birth_date.month, birth_date.day))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the readability could be improved if you use date arithmetics here, for example (assuming today = date.today())

date(
        today.year - 18,
        today.month,
        today.day
    )

and compare it with the date of birth

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried to follow your suggestion and made changes.

enums.py Outdated
age_input = input("Enter your age: ")
if not age_input.isdigit():
print("Error: Age must be a number.", file=sys.stderr)
continue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider throwing a value error here and using try/catch block instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, try to follow your suggestion and made changes

Person(name="Eliza", age=34, preferred_operating_system=OperatingSystem.ARCH),
]

laptops = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: you can consider using ruff to improve your code formatiing, something like:

pip install ruff
ruff format .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it definitely.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you get a chance to check this out?

person = Person(name=name, age=age, preferred_operating_system=preferred_os)
people.append(person)

# Find matching laptops and print count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding comments, try to see where it make sense to group these various bits of logic into methods with descriptive names.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to make changes and use different function

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! In general, apart from invoking the main method, all the logic needs to be part of some method / class. The clarity should be coming from the name of the methods and structure of the code rather than comments explaining what you are doing (those could be useful too in some cases but should not be used as a substitute for clear structure and naming).

That said, from what I see this is more like a hands-on exercise to practice some concepts so it is ok your code has less structure.

enums.py Outdated
best_os = OperatingSystem.MACOS
best_count = mac_count

if arch_count > best_count:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should design it in a way that doesn't require you to go through all possible values manually. Imagine your OperatingSystem enum containing 50 different systems. Try to use, for example, a dict structure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried to follow your suggestion

@@ -0,0 +1,21 @@
from dataclasses import dataclass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python, the naming convention for files is snake_case

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I changed them thank you

@DaryaShirokova DaryaShirokova added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Oct 12, 2025
Copy link

@DaryaShirokova DaryaShirokova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A few comments, most are just informational :)

Person(name="Eliza", age=34, preferred_operating_system=OperatingSystem.ARCH),
]

laptops = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you get a chance to check this out?

date_of_birth: date
preferred_operating_system: str

def is_adult(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to add this as a standalone method or as a part of the class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. Yes, is_adult should be a method inside the Person class. I accidentally placed it outside. I’ll move it inside the class so it can be called as person.is_adult().

total += pence
return total

def format_pence_as_string(total_pence: int)-> str:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting is a bit off in places which makes the code slightly harder to read. Using ruff or other auto formatters might help with readability (e.g. int)-> missing space)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you I installed ruff and did it.

person = Person(name=name, age=age, preferred_operating_system=preferred_os)
people.append(person)

# Find matching laptops and print count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! In general, apart from invoking the main method, all the logic needs to be part of some method / class. The clarity should be coming from the name of the methods and structure of the code rather than comments explaining what you are doing (those could be useful too in some cases but should not be used as a substitute for clear structure and naming).

That said, from what I see this is more like a hands-on exercise to practice some concepts so it is ok your code has less structure.

def parse_operating_system(s: str) -> Optional[OperatingSystem]:
s_normal = s.strip().lower()
for os in OperatingSystem:
if os.value.lower() == s_normal:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment (no need to fix) - you to made it case insensitive so it works (all good), but overall you could also use https://docs.python.org/3/library/enum.html#enum.EnumType.__getitem__

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note!I’ll keep that in mind for future refactoring.



def find_possible_laptops(laptops: List[Laptop], person: Person) -> List[Laptop]:
possible_laptops = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for you information, an alternative approach could also be

return [
        laptop for laptop in laptops 
        if laptop.operating_system == person.preferred_operating_system
    ]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! yes a list comprehension is more concise and readable

@sheetalkharab
Copy link
Author

@DaryaShirokova , Please can i change label reviewed to complete?

@DaryaShirokova
Copy link

DaryaShirokova commented Oct 16, 2025

Let me

@DaryaShirokova , Please can i change label reviewed to complete?

Let me have a quick look tomorrow or on Saturday, I was a bit busy the last couple of days :)

@DaryaShirokova DaryaShirokova added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants